﻿namespace NOAH.CMS.Repository
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    public class FilmCategoryRepository : Repository<FilmCategory>
    {
        public FilmCategory Get(int Id)
        {
            return (from p in base.dataContext.FilmCategories
                where p.ID == Id
                select p).FirstOrDefault<FilmCategory>();
        }

        public List<FilmCategory> GetAll()
        {
            return (from p in base.dataContext.FilmCategories
                orderby p.ID descending
                select p).ToList<FilmCategory>();
        }

        public List<FilmCategory> GetListCategory(int thisId)
        {
            return (from cms in base.dataContext.FilmCategories
                where cms.ID != thisId
                select cms).ToList<FilmCategory>();
        }

        public FilmCategory GetTopCategory()
        {
            return (from cms in base.dataContext.FilmCategories
                orderby cms.Order
                select cms).FirstOrDefault<FilmCategory>();
        }
    }
}

